package mutsumimod.cards.deprecated;

import com.badlogic.gdx.graphics.Color;
import com.megacrit.cardcrawl.actions.animations.VFXAction;
import com.megacrit.cardcrawl.actions.common.ReducePowerAction;
import com.megacrit.cardcrawl.actions.watcher.PressEndTurnButtonAction;
import com.megacrit.cardcrawl.actions.watcher.SkipEnemiesTurnAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.purple.Vault;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.vfx.combat.WhirlwindEffect;
import mutsumimod.actions.BetterExhaustSpecificCardAction;
import mutsumimod.cards.BaseCard;
import mutsumimod.character.Mutsumi;
import mutsumimod.powers.StandPower;
import mutsumimod.util.CardStats;

@Deprecated
public class Sleep extends BaseCard  {
    public static final String ID = makeID(Sleep.class.getSimpleName());
    public static final CardStats info = new CardStats(
            Mutsumi.Meta.CARD_COLOR,
            CardType.SKILL,
            CardRarity.RARE,
            CardTarget.SELF,
            3
    );


    public Sleep() {
        super(ID, info);
        setAttr(0,0,3);
        setAttrUpg(0,0,0);
        setShouldCopyUse(true);
        cardsToPreview = new Vault();
    }

    @Override
    public void beforeCopy(){
        clearCopyCardsAddSelf();
        addCopyCards(new Vault());
    }

    @Override
    public boolean canUse(AbstractPlayer p, AbstractMonster m){
        if(!getInCopyUse()){
            return super.canUse(p, m);
        }
        StandPower power = (StandPower) p.getPower(StandPower.POWER_ID);
        if (power == null || power.amount < this.magicNumber) {
            return false;
        }
        return super.canUse(p, m);
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        StandPower power = (StandPower) p.getPower(StandPower.POWER_ID);
        if (power == null || power.amount < this.magicNumber) {
            return;
        }
        addToBot(new ReducePowerAction(p,p,StandPower.POWER_ID,this.magicNumber));
        addToBot(new VFXAction(new WhirlwindEffect(new Color(1.0F, 0.9F, 0.4F, 1.0F), true)));
        addToBot(new SkipEnemiesTurnAction());
        addToBot(new PressEndTurnButtonAction());
    }

    @Override
    public AbstractCard makeCopy() { //Optional
        return new Sleep();
    }

    @Override
    public void onCopyNotChooseThisCard(AbstractCard chosenCard) {
        addToBot(new BetterExhaustSpecificCardAction(this));
    }

    @Override
    public void updateDescription() {
        if(getInCopyUse()){
            rawDescription = cardStrings.EXTENDED_DESCRIPTION[0];
        }else{
            rawDescription = cardStrings.DESCRIPTION;
        }
        initializeDescription();
    }

    @Override
    public void upgrade() {
        if(!upgraded){
            upgradeName();
            upgradeBaseCost(baseCost-1);
        }
    }


}